using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Message_Board - 留言板 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IMessageBoard<T> :ModelBase<MessageBoard> where T : MessageBoard, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.MessageId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return MessageId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.MessageId=dy.MessageId;
           this.ApplyUserId=dy.ApplyUserId;
           this.ApplyUserName=dy.ApplyUserName;
           this.ApplyPhone=dy.ApplyPhone;
           this.ApplyMail=dy.ApplyMail;
           this.ApplyContent=dy.ApplyContent;
           this.ApplyTime=dy.ApplyTime;
           this.ReplyUserId=dy.ReplyUserId;
           this.ReplyUserName=dy.ReplyUserName;
           this.ReplyTime=dy.ReplyTime;
           this.ReplyContent=dy.ReplyContent;
           this.AnonymousReply=dy.AnonymousReply;
           this.State=dy.State;
        } 

        #region 定义属性

     
         /// <summary>
        /// MessageId
        /// </summary>
        private String _MessageId = "";
      
        /// <summary>
        /// MessageId
        /// </summary>
        public String MessageId
        {
            get 
            {
              return   (this._MessageId); 
            }

            set 
            {
                    _MessageId= value;  
            }
        }
       
     
         /// <summary>
        /// 留言人ID
        /// </summary>
        private String _ApplyUserId = "";
      
        /// <summary>
        /// 留言人ID
        /// </summary>
        public String ApplyUserId
        {
            get 
            {
              return   (this._ApplyUserId); 
            }

            set 
            {
                    _ApplyUserId= value;  
            }
        }
       
     
         /// <summary>
        /// 留言人名称
        /// </summary>
        private String _ApplyUserName = "";
      
        /// <summary>
        /// 留言人名称
        /// </summary>
        public String ApplyUserName
        {
            get 
            {
              return   (this._ApplyUserName); 
            }

            set 
            {
                    _ApplyUserName= value;  
            }
        }
       
     
         /// <summary>
        /// 联系电话
        /// </summary>
        private String _ApplyPhone = "";
      
        /// <summary>
        /// 联系电话
        /// </summary>
        public String ApplyPhone
        {
            get 
            {
              return   (this._ApplyPhone); 
            }

            set 
            {
                    _ApplyPhone= value;  
            }
        }
       
     
         /// <summary>
        /// 联系邮箱
        /// </summary>
        private String _ApplyMail = "";
      
        /// <summary>
        /// 联系邮箱
        /// </summary>
        public String ApplyMail
        {
            get 
            {
              return   (this._ApplyMail); 
            }

            set 
            {
                    _ApplyMail= value;  
            }
        }
       
     
         /// <summary>
        /// 留言内容
        /// </summary>
        private String _ApplyContent = "";
      
        /// <summary>
        /// 留言内容
        /// </summary>
        public String ApplyContent
        {
            get 
            {
              return   (this._ApplyContent); 
            }

            set 
            {
                    _ApplyContent= value;  
            }
        }
       
     
         /// <summary>
        /// 留言时间
        /// </summary>
        private DateTime _ApplyTime =DateTime.MinValue;
      
        /// <summary>
        /// 留言时间
        /// </summary>
        public DateTime ApplyTime
        {
            get 
            {
              return   (this._ApplyTime); 
            }

            set 
            {
                    _ApplyTime= value;  
            }
        }
       
     
         /// <summary>
        /// 回复ID
        /// </summary>
        private String _ReplyUserId = "";
      
        /// <summary>
        /// 回复ID
        /// </summary>
        public String ReplyUserId
        {
            get 
            {
              return   (this._ReplyUserId); 
            }

            set 
            {
                    _ReplyUserId= value;  
            }
        }
       
     
         /// <summary>
        /// 回复姓名
        /// </summary>
        private String _ReplyUserName = "";
      
        /// <summary>
        /// 回复姓名
        /// </summary>
        public String ReplyUserName
        {
            get 
            {
              return   (this._ReplyUserName); 
            }

            set 
            {
                    _ReplyUserName= value;  
            }
        }
       
     
         /// <summary>
        /// 回复时间
        /// </summary>
        private DateTime _ReplyTime =DateTime.MinValue;
      
        /// <summary>
        /// 回复时间
        /// </summary>
        public DateTime ReplyTime
        {
            get 
            {
              return   (this._ReplyTime); 
            }

            set 
            {
                    _ReplyTime= value;  
            }
        }
       
     
         /// <summary>
        /// 回复内容
        /// </summary>
        private String _ReplyContent = "";
      
        /// <summary>
        /// 回复内容
        /// </summary>
        public String ReplyContent
        {
            get 
            {
              return   (this._ReplyContent); 
            }

            set 
            {
                    _ReplyContent= value;  
            }
        }
       
     
         /// <summary>
        /// 是否匿名回复
        /// </summary>
        private int _AnonymousReply =int.MinValue;
      
        /// <summary>
        /// 是否匿名回复
        /// </summary>
        public int AnonymousReply
        {
            get 
            {
              return   (this._AnonymousReply); 
            }

            set 
            {
                    _AnonymousReply= value;  
            }
        }
       
     
         /// <summary>
        /// 状态
        /// </summary>
        private int _State =int.MinValue;
      
        /// <summary>
        /// 状态
        /// </summary>
        public int State
        {
            get 
            {
              return   (this._State); 
            }

            set 
            {
                    _State= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(MessageBoard info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["MessageId"]!= DBNull.Value)
                  {
                  info.MessageId=row["MessageId"].ToString();
                 }
                 
                  
                  if(row["ApplyUserId"]!= DBNull.Value)
                  {
                  info.ApplyUserId=row["ApplyUserId"].ToString();
                 }
                 
                  
                  if(row["ApplyUserName"]!= DBNull.Value)
                  {
                  info.ApplyUserName=row["ApplyUserName"].ToString();
                 }
                 
                  
                  if(row["ApplyPhone"]!= DBNull.Value)
                  {
                  info.ApplyPhone=row["ApplyPhone"].ToString();
                 }
                 
                  
                  if(row["ApplyMail"]!= DBNull.Value)
                  {
                  info.ApplyMail=row["ApplyMail"].ToString();
                 }
                 
                  
                  if(row["ApplyContent"]!= DBNull.Value)
                  {
                  info.ApplyContent=row["ApplyContent"].ToString();
                 }
                 
                  
                  if(row["ApplyTime"]!= DBNull.Value)
                  {
                  info.ApplyTime=Convert.ToDateTime(row["ApplyTime"]);
                 }
                 
                  
                  if(row["ReplyUserId"]!= DBNull.Value)
                  {
                  info.ReplyUserId=row["ReplyUserId"].ToString();
                 }
                 
                  
                  if(row["ReplyUserName"]!= DBNull.Value)
                  {
                  info.ReplyUserName=row["ReplyUserName"].ToString();
                 }
                 
                  
                  if(row["ReplyTime"]!= DBNull.Value)
                  {
                  info.ReplyTime=Convert.ToDateTime(row["ReplyTime"]);
                 }
                 
                  
                  if(row["ReplyContent"]!= DBNull.Value)
                  {
                  info.ReplyContent=row["ReplyContent"].ToString();
                 }
                 
                  
                  if(row["AnonymousReply"]!= DBNull.Value)
                  {
                  info.AnonymousReply=Convert.ToInt32(row["AnonymousReply"]);
                 }
                 
                  
                  if(row["State"]!= DBNull.Value)
                  {
                  info.State=Convert.ToInt32(row["State"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, MessageBoard info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@MessageId", DbType.String,ParameterTool.GetObj( info._MessageId )); 
            
             
                cn.AddInParameter(comm, "@ApplyUserId", DbType.String,ParameterTool.GetObj( info._ApplyUserId )); 
            
             
                cn.AddInParameter(comm, "@ApplyUserName", DbType.String,ParameterTool.GetObj( info._ApplyUserName )); 
            
             
                cn.AddInParameter(comm, "@ApplyPhone", DbType.String,ParameterTool.GetObj( info._ApplyPhone )); 
            
             
                cn.AddInParameter(comm, "@ApplyMail", DbType.String,ParameterTool.GetObj( info._ApplyMail )); 
            
             
                cn.AddInParameter(comm, "@ApplyContent", DbType.String,ParameterTool.GetObj( info._ApplyContent )); 
            
             
                cn.AddInParameter(comm, "@ApplyTime", DbType.DateTime,ParameterTool.GetObj( info._ApplyTime )); 
            
             
                cn.AddInParameter(comm, "@ReplyUserId", DbType.String,ParameterTool.GetObj( info._ReplyUserId )); 
            
             
                cn.AddInParameter(comm, "@ReplyUserName", DbType.String,ParameterTool.GetObj( info._ReplyUserName )); 
            
             
                cn.AddInParameter(comm, "@ReplyTime", DbType.DateTime,ParameterTool.GetObj( info._ReplyTime )); 
            
             
                cn.AddInParameter(comm, "@ReplyContent", DbType.String,ParameterTool.GetObj( info._ReplyContent )); 
            
             
                cn.AddInParameter(comm, "@AnonymousReply", DbType.Int32,ParameterTool.GetObj( info._AnonymousReply )); 
            
             
                cn.AddInParameter(comm, "@State", DbType.Int32,ParameterTool.GetObj( info._State )); 
            
        } 

    } 
} 